package com.group4.edu.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.group4.edu.entity.Teacher;
import com.group4.edu.mapper.TeacherMapper;
import com.group4.edu.service.TeacherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 讲师 服务实现类
 * </p>
 *
 * @author cloud
 * @since 2022-03-10
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements TeacherService {
    @Autowired
    TeacherMapper teacherMapper;

    @Override
    public PageInfo<Teacher> listAll(int Pagenum) {
        List<Teacher>teachers=teacherMapper.selectList(null);
        return new PageInfo<>(teachers);
    }

    @Override
    public PageInfo<Teacher> listByCondition(int pageNum,Teacher teacher) {
        List<Teacher>teachers=teacherMapper.findByCondition(teacher);
        return new PageInfo<>(teachers);
    }

    @Override
    public List<Teacher> findBy(Teacher teacher){
        return teacherMapper.findByCondition(teacher);
    }


    @Override
    public void update(Teacher teacher) {
        teacherMapper.updateById(teacher);
    }


}
